home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / jpl_c.zip / SETBUF.C < prev    next >
Text File  |  1986-05-18  |  1KB  |  32 lines

  1. /* 1.2  05-08-85 */
  2. /************************************************************************
  3.  *            Robert C. Tausworthe                *
  4.  *            Jet Propulsion Laboratory            *
  5.  *            Pasadena, CA 91009        1985        *
  6.  ************************************************************************/
  7.  
  8. #include "defs.h"
  9. #include "stdtyp.h"
  10. #include "stdio.h"
  11.  
  12. /************************************************************************/
  13.     VOID
  14. setbuf(fp, buffer)    /* If a buffer is assigned to FILE fp, liberate
  15.                it.  Assign buffer (assumed BUFSIZ bytes) if
  16.                not NULL; otherwise, assign the 1-byte buffer. */
  17. /*----------------------------------------------------------------------*/
  18. FAST FILE *fp;
  19. BUFFER buffer;
  20. {
  21.     if (fp->_buff AND fp->_flags & _ALLBUF)
  22.         liberate(fp->_buff, fp->_buflen);
  23.     if (buffer)
  24.     {    fp->_buff = buffer;
  25.         fp->_buflen = BUFSIZ;
  26.     }
  27.     else
  28.     {    fp->_buff = &fp->_bytbuf;
  29.         fp->_buflen = 1;
  30.     }
  31. }
  32.